﻿<%@ WebHandler Language="C#" Class="CaegoryProduct_UpdateStatus" %>

using System;
using System.Web;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

public class CaegoryProduct_UpdateStatus : IHttpHandler
{
    TblDanhMucSanPhamManager _TblDanhMucSanPhamManager = new TblDanhMucSanPhamManager();
    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/html";
        string check = "";
        int CateID = 0;
        try { CateID = Convert.ToInt32(context.Request.QueryString["id"].Trim()); }
        catch { CateID = 0; }

        if (CateID != 0)
        {
            TblDanhMucSanPhamEntity _TblDanhMucSanPhamEntity = _TblDanhMucSanPhamManager.SelectOne(CateID);
            _TblDanhMucSanPhamEntity.TrangThai = !_TblDanhMucSanPhamEntity.TrangThai;
            check = _TblDanhMucSanPhamEntity.TrangThai.ToString();

            try { _TblDanhMucSanPhamManager.Update(_TblDanhMucSanPhamEntity).ToString(); check = _TblDanhMucSanPhamEntity.TrangThai.ToString().ToLower(); }
            catch { }
        }
        context.Response.Write(check);
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}